﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETL.Business.Handlers.ProjectCategoryHandler;
using ETL.Business.Handlers.ProjectHandlers;
using ETL.Business.Handlers.ProjectManagementHelper;
using ETL.Business.Handlers.ProjectTaskHandler;
using ETL.Business.Handlers.ProjectTimeHandler;
using ETL.Business.Handlers.SessionHandler;
using ETL.Business.Models;
using ETL.Common;

namespace ETL.Business.Helpers
{
    public class StartUp
    {
        public StartUp()
        {}
        public virtual void Execute(string userId)
        {
            int i = 0;

            // get userid, engType
            (new GetUserId()).Execute(userId);

            // Check management to add M after userId
            var allPrjMng = (new GetAllProjectManagement()).Execute();

            // set default management mode
            (new SetSessionData()).Execute(Constants.SessionVars.Management, "False");
            // check management mode
            foreach (ProjectMangementModel projectMangementModel in allPrjMng)
            {
                if(projectMangementModel.Id.Equals(userId))
                {
                    // set management mode, break
                    (new SetSessionData()).Execute(Constants.SessionVars.Management, "True");
                }
            }

            // Get last task of user
            (new GetLastTask()).Execute();

            // Check free entry allowed
            // ---- DOESN'T NEED ----


            // Read projects
            // ---- DONE IN CONTROLLER ----
  
            
        }
    }
    
}
